
#include "object.h"
#include "adapter.h"

#include <iostream>
#include <string>

using namespace std;

void show(const Point& p1, const Point& p2,
		  const string& str, const bool& isEmpty)
{
	if (isEmpty)
	{
		cout<<"I'm empty."<<endl;
	}
	else
	{
		cout<<str<<endl;
		cout<<"BottomLeft: ("<<p1.x<<", "<<p1.y<<")"<<endl;
		cout<<"Topright:   ("<<p2.x<<", "<<p2.y<<")"<<endl;
	}
}

int main()
{
	Point p1, p2;
	string str;
	bool bEmpty;

	ShapeTextClassAdapter shapeTextClass;

	shapeTextClass.setBoundPoint(Point(1, 1), Point(3, 2));
	shapeTextClass.setText("I'm ShapeTextClassAdapter.");

	shapeTextClass.getBoundPoint(p1, p2);
	shapeTextClass.getText(str);
	bEmpty = shapeTextClass.isEmpty();
	show(p1, p2, str, bEmpty);
	cout<<endl;

	TextView textView;
	ShapeTextObjectAdapter shapeTextObject(&textView);

	shapeTextObject.getBoundPoint(p1, p2);
	shapeTextObject.getText(str);	
	bEmpty = shapeTextObject.isEmpty();
	show(p1, p2, str, bEmpty);
	cout<<endl;

	shapeTextObject.setBoundPoint(Point(1, 1), Point(4, 3));
	shapeTextObject.setText("I'm ShapeTextObjectAdapter.");

	shapeTextObject.getBoundPoint(p1, p2);
	shapeTextObject.getText(str);	
	bEmpty = shapeTextObject.isEmpty();
	show(p1, p2, str, bEmpty);
	cout<<endl;

	return 0;
}
